#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
const int N = 110;
vector<int> as[N];
int idx[N];
int n;
int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        int j = 0;
        while (cin >> j, j)
        {
            as[i].push_back(j);
            idx[j]++;
        }
    }
    queue<int> q;
    for (int i = 1; i <= n; i++)
    {
        if (idx[i] == 0)
        {
            q.push(i);
        }
    }
    while (q.size())
    {
        int a = q.front();
        q.pop();
        cout << a << " ";
        for (auto& e : as[a])
        {
            idx[e]--;
            if (idx[e] == 0)
            {
                q.push(e);
            }
        }
    }

    return 0;
}